<?php

namespace app\validate;

use think\Validate;

class Category extends Validate
{
    protected $rule = [
        'name' => 'require',
        'parent_id' => 'require|integer',
        'id'=>'require',
        'state'=>'require'
    ];
    protected $message = [
        'name.require'=> '分类名称必填',
        'parent_id.require'=>'父级分类必填',
        'parent_id.integer'=>'父级分类必须为数字',
        'id.require'=>'ID必填',
        'state.require'=>'状态必填'
    ];
    protected $scene = [
      'add'=>['name','parent_id','state'],
      'edit'=>['name','parent_id','id','state']
    ];
}